<template>
	<view class="content">
	</view>
</template>

<script>

	export default {
		data() {
			return {
				title: '引导页'
			}
		},
		onLoad() {
			// this.getDate()
			this.ifLaunchFlag() 
		},
		methods: {
			//是否登录状态,未登录跳登录
			isLogin(){
				if (!this.$store.state.userName) {    //未登录
				    uni.reLaunch({
				        url: '../login/login',
				    });
				}else{
					uni.reLaunch({
					    url: '../main/main',
					});
				}
			},
			//是否第一次使用app
			ifLaunchFlag(){
				//第一次使用跳引导页，否则留在当前页，继续判断是否登录状态
				if(!uni.getStorageSync('ifLaunch')) {
					uni.reLaunch({
						url: '../guide/guide'
					})
				}else{
					console.log('老用户');
					this.isLogin()
				}
			},
			//数据请求实例
			getDate(){
				//post
				this.$http.post("/consumer-management/pointsGoods/findGoods",{
					flag: 1
				}).then((res)=>{
					uni.showModal({
						title: '提示',
						content: '这是一个模态弹窗',
						success: function (res) {
							if (res.confirm) {
								console.log('用户点击确定');
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}).catch((res)=>{
					console.log(res);
				})
				//get
				this.$http.get("/consumer-management/welcome/page/banner/1").then(res=>{
					console.log(res);
				}).catch(res=>{
					console.log(res);
				})
			}
		}
	}
</script>

<style scoped>
	.content {
		text-align: center;
		height: 400upx;
	}
    .logo{
        height: 200upx;
        width: 200upx;
        margin-top: 200upx;
    }
	.title {
		font-size: 36upx;
		color: #8f8f94;
	}
</style>
